package com.wpre.lotterysystem.service.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * Created with IntelliJ IDEA.
 * Description:用户身份的枚举类(管理员用户和普通用户)
 * User: LianBao
 * Date: 2024-12-14
 * Time: 14:54
 */
@AllArgsConstructor
@Getter
public enum UserIdentityEnum {
    ADMIN("管理员"),
    NORMAL("普通用户");
    private final String msg;

    public static UserIdentityEnum forName(String name) {
        //遍历枚举类中所有的值,如果枚举类中不存在这个身份,返回null
        for (UserIdentityEnum identity : UserIdentityEnum.values()) {
            if (identity.name().equalsIgnoreCase(name)) {
                return identity;
            }
        }
        return null;
    }

}
